class TaskEnv:
    """
    >>> env = TaskEnv()
    >>> bool(env)
    False
    >>> env = TaskEnv({'key': 'value'})
    >>> env.export({'key2': 'value2'})
    >>> 'key2' in env.value()
    False
    >>> env.apply_export()
    >>> 'key2' in env.value()
    True
    """
    def __init__(self, env: dict = None):
        self._env = env or {}
        self._exports = {}
        self._temp_exports = {}

    def __bool__(self):
        return bool(self._env or self._exports)

    def value(self) -> dict:
        ret = {}
        ret.update(self._env)
        ret.update(self._exports)
        return ret

    def export(self, export_values: dict):
        self._temp_exports.update(export_values)

    def apply_export(self):
        self._exports.update(self._temp_exports)
        self._temp_exports = {}
